<template>
  <div>
    <div>
      <!-- Ant Design of Vue 中需要特殊的写法 -->
      <a-input v-model:value="searchText" />
      <!-- 正常使用 v-model 即可 -->
      <input v-model="searchText" />
    </div>
    <a-divider></a-divider>
    <div>
      <a-input :value="searchText" @input="searchText = $event.target.value" />
    </div>
    <a-divider></a-divider>

    <div>
      <CustomInput v-model="searchText"></CustomInput>
    </div>
    <a-divider></a-divider>

    <div>
      <CustomInput
        :modelValue="searchText"
        @update:modelValue="(newValue) => update(newValue)"
      ></CustomInput>
    </div>
  </div>
</template>

<script>
import CustomInput from "./CustomInput.vue";
export default {
  components: {
    CustomInput,
  },
  data() {
    return {
      searchText: "",
    };
  },
  methods: {
    update(value) {
      this.searchText = value;
    },
  },
};
</script>

<style>
input {
  width: 100%;
  margin: 8px 0;
  border: 1px solid rgb(0, 205, 112);
}
</style>
